package service

import (
	"context"
	"shopAdd-srv/dao"
	"shopAdd-srv/internal/model"
	__ "shopAdd-srv/proto"
)

func (s *Shop) OrderAdd(_ context.Context, in *__.OrderAddReq) (*__.OrderAddResp, error) {

	orderAddService := dao.NewOrderService()
	add, err := orderAddService.OrderAdd(model.Order{
		ShopId: int(in.ShopId),
		UserId: int(in.UserId),
	})
	if err != nil {
		return nil, err
	}

	return &__.OrderAddResp{
		OrderId: int64(add),
	}, nil
}
